package com.qianfeng.missfood.utils;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.GridView;

/**
 * Created by TaoTao on 2015/8/17.
 */
public class CategoryGridView extends GridView {
    public CategoryGridView(Context context) {
        super(context);
    }

    public CategoryGridView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CategoryGridView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public CategoryGridView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    //解决内容显示不全  缺点   convertView 无法复用
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int measureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, measureSpec);
    }

//    //事件分发   解决事件冲突(这个东西会导致item的点击事件不可用)
//    @Override
//    public boolean dispatchTouchEvent(MotionEvent ev) {
//        return true;
//    }

}
